
$(function(){
  /*缩放插件 ReWrite by bin*/
    function ScaleSlider() {
     /* transform: scale(0.683077);*/
                var bodyWidth = document.body.clientWidth;
                console.log(bodyWidth);
                if (bodyWidth){
                  //判断大小
                    var scaleSize = bodyWidth/1903;
                    console.log(Math.min(bodyWidth, 1903));

                      if (scaleSize <= 1){
                         $('.fullSlide,.fullSlide .bd li,.fullSlide .bd li a').css('height',bodyWidth/1903*560);
                         //$('.fullSlide .bd>ul>li').css('background-size','cover');
                      }else{
                         $('.fullSlide,.fullSlide .bd li,.fullSlide .bd li a').css('width',1903);
                         $('.fullSlide,.fullSlide .bd li,.fullSlide .bd li a').css('height',560);
                         //$('.fullSlide .bd>ul>li').css('background-size','auto');
                      }


                }else{
                    window.setTimeout(ScaleSlider, 30);}
                }
    ScaleSlider();


  $(window).resize(function(){
    ScaleSlider();
  });


  var new_scroll_position = 0;
  var last_scroll_position;
  var header =$("header");

  window.addEventListener('scroll', function(e) {
    last_scroll_position = window.scrollY;

    // Scrolling down
    if (new_scroll_position < last_scroll_position && last_scroll_position > 80) {
    header.removeClass('slideDown').addClass('header-small');

    // Scrolling up
    } else if (new_scroll_position > last_scroll_position) {
    
    header.removeClass('header-small').addClass('slideDown');

    }




    new_scroll_position = last_scroll_position;
  });





});


/* 导航特效 */
$("#header-nav .navli").hover(
  function(){
    $(this).addClass("active");
    $(this).find(".sub-nav").show();
    $(this).find(".sub-nav").animate({
      opacity:1,
      marginTop:"15px"
    },200);
    $(this).siblings("li").removeClass("active");
  },
  function(){
    //$(this).removeClass("active");
    $(this).find(".sub-nav").animate({
      opacity:0,
      marginTop:"15px"
    },200);
    $(this).find(".sub-nav").hide();
  }
)
/*导航附加*/
$("#header-nav ul").hover(
  function(){
    
  },function(){
    $(this).find(".navli").removeClass("active");
  }
)
/**/
